package com.yc.controller;

import com.yc.web.bean.ResponseResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;
@Slf4j
@RestController
@Tag( name="show hello",description = "显示不同语言的hello")
public class HelloController {
    private static final String[] HELLO_WORLDS = {
            "Hello World",          // English
            "Hola Mundo",           // Spanish
            "Bonjour le monde",     // French
            "Hallo Welt",           // German
            "こんにちは世界",         // Japanese
            "Привет, мир",          // Russian
            "你好，世界",            // Chinese
            "مرحبا بالعالم",        // Arabic
            "Olá Mundo",            // Portuguese
            "नमस्ते दुनिया"         // Hindi
    };

    @Operation(summary = "显示hello")
    @GetMapping("/hello")
    public ResponseResult sayHello() {
        Random random = new Random();
        String randomHello = HELLO_WORLDS[random.nextInt(HELLO_WORLDS.length)];
        return ResponseResult.ok().setData(randomHello);
    }
}
